Skip to content

Stack overflow error when opening large CSV files ("Maximum call stack size exceeded")#70

Merged
jonaraphael merged 2 commits intojonaraphael:mainfrom
xXLeoXxOne:main
Feb 6, 2026
Merged

Stack overflow error when opening large CSV files ("Maximum call stack size exceeded")#70
jonaraphael merged 2 commits intojonaraphael:mainfrom
xXLeoXxOne:main

Conversation

@xXLeoXxOne
Copy link
Contributor

Description

Opening CSV files with many rows causes the extension to crash with RangeError: Maximum call stack size exceeded.

Stack trace:

RangeError: Maximum call stack size exceeded
    at CsvEditorController.getEffectiveHeader (CsvEditorProvider.js:691:33)
    at CsvEditorController.updateWebviewContent (CsvEditorProvider.js:528:34)
    at CsvEditorController.resolveCustomTextEditor (CsvEditorProvider.js:66:14)
    ...

Steps to reproduce

  1. Open a file with a very large number of rows (see energy_train.csv)
  2. Observe the error

Root Cause

The extension uses Math.max(...array) spread syntax in multiple locations to calculate the maximum column count.
When the CSV has many rows, spreading the array into Math.max() exceeds JavaScript's call stack limit (~65K arguments).

Fix suggestion

Use a stack-safe approach through using reduce()

@jonaraphael jonaraphael merged commit 817104f into jonaraphael:main Feb 6, 2026
@jonaraphael
Copy link
Owner

Thank you for your contribution!
It's much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants